<template>
    <a-modal
        :title="title"
        :width="width"
        :visible="visible"
        :okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
        @ok="handleOk"
        @cancel="handleCancel"
    >
        <ProcessBind ref="ProcessBind" :editable="editable" :editableFiexd="editableFiexd" :showBuildTime="showBuildTime" :canDismiss="canDismiss" :dataId="dataId" v-model="formData"></ProcessBind>
    </a-modal>
</template>

<script>
import ProcessBind from './ProcessBind'
export default {
    name:'ProcessBindModal',
    components:{
        ProcessBind
    },
    data(){
        return {
            title:'',
            width:800,
            visible: false,
            disableSubmit: false,
            canDismiss:false,
            editable:true,
            showBuildTime:false,
            formData:{},
            editableFiexd:{},
            dataId:'',
            successTxt:''
        }
    },
    methods:{
        add (record,editableFiexd) {
            this.visible = true
            this.$nextTick(()=>{
                this.editableFiexd = editableFiexd
                this.$refs.ProcessBind.add(record)
            })
        },
        edit (record,editableFiexd) {
            this.visible = true
            this.$nextTick(()=>{
                this.editableFiexd = editableFiexd
                this.$refs.ProcessBind.edit(record)
            })
        },
        review (record) {
            this.title = '查看'
            this.visible=true
            this.editable = false
            this.disableSubmit = true
            this.$nextTick(()=>{
                this.$refs.ProcessBind.open(record)
            })
        },
        close () {
            this.$emit('close');
            this.title = ''
            this.editable = true
            this.formData = {}
            this.editableFiexd = {}
            this.disableSubmit = false
            this.visible = false
            this.showBuildTime = false
            this.canDismiss = false
        },
        handleOk () {
            this.$refs.ProcessBind.submitForm().then(res=>{
                this.$emit('ok');
                this.visible = false;
            })
        },
        handleCancel () {
            this.close()
        }
    }
}
</script>

<style>

</style>